package com.goods.business.converter;

import com.goods.common.model.business.Consumer;
import com.goods.common.vo.business.ConsumerVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class ConsumerConverter {
    public static List<ConsumerVO> converterToConsumerVOList(List<Consumer> consumers) {
        if (!CollectionUtils.isEmpty(consumers)){
            List<ConsumerVO> consumerVOS = new ArrayList<>();
            for (Consumer consumer : consumers) {
                ConsumerVO consumerVO = new ConsumerVO();
                BeanUtils.copyProperties(consumer,consumerVO);
                consumerVOS.add(consumerVO);
            }
            return consumerVOS;
        }
        return null;
    }
}
